<!--b noi dung-->
<div class="noidung_d fl">
    <div class="breadcrumbs">
        <ul>
            <li class="home"><a href="./trang-chu.html">Trang chủ</a><span>&gt;</span></li>
            <li class="product">
                <strong>Giỏ hàng</strong>
            </li>
        </ul>
    </div>
    <div id="cart_page">
        <div class="cart_left">
        <div class="cart_header">
            <div class="content_num_items"><p><?php echo $GLOBALS['lng']['you_have'] ?> <span class="items"><span class="slcart"><?php echo $num_item_cart ?></span> <?php echo $GLOBALS['lng']['items'] ?></span> <?php echo $GLOBALS['lng']['in_shopping_cart'] ?></p></div>
            <div class="content_remove"><p><?php echo $GLOBALS['lng']['cancel'] ?></p></div>
            <div class="content_qty"><p><?php echo $GLOBALS['lng']['qty'] ?></p></div>
            <div class="content_price"><p><?php echo $GLOBALS['lng']['amount'] ?></p></div>
            <div class="separator"></div>
        </div>
        <?php
        $total = 0;
        if (count($carts) && is_array($carts))
        {
            foreach ($carts as $data)
            {
                $thanhtien = $data['gia'] * $data['soluong'];
                $total += $thanhtien;
            ?>
        <div class="cart_content CardItem<?php echo $data['id'] ?>">
            <div class="content_img"><a href="./<?php echo $data['catkey'] ?>/<?php echo $data['keyword'] ?>-<?php echo $data['product'] ?>.html"><img src="<?php echo PRO.'thumbs/'.$data['img'] ?>" alt="<?php echo $data['name'] ?>" /></a></div>
            <div class="content_desc">
                <h2 style="font-weight: normal">
                    <a href="./<?php echo $data['catkey'] ?>/<?php echo $data['keyword'] ?>-<?php echo $data['product'] ?>.html"><?php echo $data['name'] ?></a>
                <?php
                $pricelist = trim($data['pricelist']);
                $pricelists = explode("\n", $pricelist);
                if($pricelist && count($pricelists) > 1)
                {
                ?>
                </h2>
                <table width="145">
                    <tr>
                        <th class="pricelist_head" style="padding: 1px;"><?php echo $GLOBALS['lng']['qty'] ?></th>
                        <th class="pricelist_head" style="padding: 1px;"><?php echo $GLOBALS['lng']['price'] ?></th>
                    </tr>
                    <?php
                    for($n=0; $n < count($pricelists); $n++)
                    {
                        $pricelist = explode(':', $pricelists[$n]);
                        $ranges = explode('-', $pricelist[0]);
                        if($data['soluong'] >= trim($ranges[0]) && (!empty($ranges[1]) && $data['soluong'] <= trim($ranges[1])))
                        {
                            $selected = ' selected';
                        }
                        else
                        {
                            $selected = '';
                        }
                        echo '<tr>
                            <td class="pricelist_td'.$selected.'" style="padding: 1px;">'.$pricelist[0].'</td>
                            <td class="pricelist_td'.$selected.'" style="padding: 1px;">'.number_format($pricelist[1] * 1000).'đ</td>
                        </tr>';
                    }
                ?>
                </table>
                <?php
                }
                else
                {
                    echo '<p style="clear: both; font-weight: normal">'.$GLOBALS['lng']['price'].': '.number_format($data['gia']).'đ</p></h2>';
                }
                ?>
            </div>
            <div class="content_remove remove_cart"><a href="javascript:;" title="<?php echo $GLOBALS['lng']['remove_item'] ?>" data-id="<?php echo $data['id'] ?>"><img src="resources/images/remove_item.png" alt="<?php echo $GLOBALS['lng']['remove_item'] ?>" /></a></div>
            <div class="content_qty">
                <div class="input text">
                    <input type="text" size="1" maxlength="5" value="<?php echo $data['soluong'] ?>" data-id="<?php echo $data['id'] ?>" autocomplete="off" class="mini_qty" style="height: 21px;" />
                </div>
            </div>
            <div class="content_price"><p><span class="CartTotal<?php echo $data['id'] ?>"><?php echo number_format($thanhtien) ?></span>đ</p></div>
            <div class="separator"></div>
        </div>
            <?php
            }
        }
        ?>
        <div class="mini_empty" style="min-height: 200px;"><h4><?php echo $GLOBALS['lng']['your_cart_empty'] ?></h4></div>
            <div style="margin-bottom: 20px;"></div>
        </div>
        <div class="cart_right" style="padding-top: 10px;">
            <div class="order_box">
                <div class="order_total">
                    <p class="sub_total"><?php echo $GLOBALS['lng']['total'] ?> (<span class="slcart"><?php echo $num_item_cart ?></span> <?php echo $GLOBALS['lng']['items'] ?>)</p>
                    <p class="total"><span class="subtotal"><?php echo number_format($total) ?></span>đ</p>
                    <?php
                    if($num_item_cart)
                    {
                    ?>
                    <a href="./thanh-toan.html" class="btn" id="btnThanhtoan"><i class="fa-icon-ok"></i> <?php echo $GLOBALS['lng']['payment'] ?></a>
                    <?php
                    }
                    ?>
                </div>
            </div>
            <div class="disclaimer">
                <?php if($num_item_cart) { ?>
                <p>[<a href="javascript:;" class="removeCartAll">Xóa</a>] tất cả sản phẩm trong giỏ hàng</p><br />
                <?php } ?>
            </div>
        </div>
        <div class="clr_fix"></div>
    </div>
</div>